import Vue from "vue";
import VueRouter from "vue-router";

import Home from "./views/Home.vue";
import DistributDetails from "./components/DistributDetails";

Vue.use(VueRouter);

const routes = [
  { path: "/", redirect: "/distributDetails" },
  {
    path: "/home",
    component: Home,
    children: [
      {
        path: "/distributDetails",
        name: "DistributDetails",
        component: DistributDetails
      },
      {
        path: "/shop",
        name: "Shop",
        component: () => import("./components/shop")
      },
      {
        path: "/cashManage",
        name: "CashManage",
        component: () => import("./components/CashManage")
      }
    ]
  },
  {
    path: "/cash",
    name: "Cash",
    component: () => import("./views/cash.vue")
  }
];

const router = new VueRouter({
  scrollBehavior: () => ({ y: 0 }),
  routes
});

export default router;
